package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("fos.txt");
        /*String line = "UTF-8 万国码，英文，数字，" +
                "符号占一个字节，中文每个占三个字节";
        byte[] date = line.getBytes(StandardCharsets.UTF_8);
        fos.write(date);
        line = "over";
        fos.write(line.getBytes(StandardCharsets.UTF_8));*/
        /*fos.write("爱你孤身走暗巷".getBytes(StandardCharsets.UTF_8));
        System.out.println("写出成功");
        fos.write("爱你不跪的模样".getBytes(StandardCharsets.UTF_8));
        fos.close();
        fos = new FileOutputStream("fos.txt", true);
        fos.write("爱你不跪的模样1111111111".getBytes(StandardCharsets.UTF_8));
        fos.close();*/


        FileInputStream fis = new FileInputStream("fos.txt");
        byte[] date = new byte[3];
        fis.read(date);
        fos.write(date);
        System.out.println("yixiechu");
        fos.close();
        fis.close();
    }
}
